use "xwvsevs_1981_2000_v20060423.dta", clear
drop if x028==4 & c033!=.
drop if x028==5 & c033!=.
drop if x028==6 & c033!=.
drop if x028==7 & c033!=.
drop if x028==8 & c033!=.
gen country_status=(s003*1000*x028)

** INDIVIDIDUAL VARIABLES **
* FEMALE
recode  x001 (2=1) (1=0)
* OCCUPATION
gen occup=x036
recode occup (11=1) (12=1) (13=1) (14=.) (15=.) (16=2) (21=3) (22=3) (23=3) (24=3) (25=3) (31=3) (32=3) (33=3) (34=3) (41=4) (42=4) (51=.) (81=.) (61=.)
* MARRIED
gen dummy_married=x007
recode dummy_married (1=1) (2=1) (3=0) (4=0) (5=0) (6=0) (7=0)
* SELF EMPLOYED
gen dum_empl3=x028
recode dum_empl3 (1=0) (2=0) (3=1) (4=0) (5=0) (6=0) (7=0) (8=0)

** MACRO VARIABLES ** 
* FINANCIAL DEVELOPMENT
gen findev=s025
recode findev (321991=12.59)(401990=89.73)(401999=98.97)(561981=29.86)(561990=36.95)(561999=81.6)(761991=42.7)(1001990=82.8)(1001999=12.08)(1122000=8.87)(1241982=69.6)(1241990=75.85)(1521990=47.15)(1561990=87.71)(1911999=37.42)(2031990=73.21)(2031991=73.21)(2031999=56.8)(2081981=39.14)(2081990=52.18)(2081999=35.03)(2331990=20.2)(2331999=24.31)(2462000=53.99)(2501981=101.77)(2501990=94.28)(2501999=81.65)(2761990=88.67)(2761999=115.63)(3001999=46.26)(3481991=39.17)(3481999=26.06)(3521984=40.47)(3521990=43.66)(3521999=75.78)(3561990=25.24)(3721981=42.4)(3721990=47.61)(3721999=102.61)(3801981=54.11)(3801990=56.47)(3801999=71.78)(3921990=195.98)(4281999=14.49)(4401990=.)(4401999=12.79)(4421999=105.54)(4701983=44.68)(4701999=113.93)(4841990=17.47)(5281981=90.42)(5281990=79.91)(5281999=129.42)(5661990=9.41)(5781982=51.67)(5781990=81.71)(6161989=1.68)(6161990=21.1)(6161999=25.5)(6201990=49.12)(6201999=119.92)(6421993=.)(6421999=8.07)(6431990=.)(6431999=13.09)(7031990=.)(7031991=.)(7031999=54.6)(7051992=23.27)(7051999=33.52)(7101990=80.95)(7241981=77.47)(7241990=77.71)(7241999=89.02)(7521982=84.76)(7521990=127.43)(7521999=101.03)(7561989=162.17)(7922001=20.67)(8041999=8.59)(8261981=32.82)(8261990=115.78)(8261999=121.82)(8401982=111.99)(8401990=144.02)(9001981=.)(9091981=32.82)(9091990=115.78)(9091999=121.82)( 4101990=62.76)( 4701991=85.04) (4281990=.)(2461990=86.62) (1000/8912001=.)
* GDP
gen GDP_pc=s025
recode GDP_pc (561981=15585.98)(2081981=20272.72)(2501981=15750.08)(3721981=10160.63)(3801981=13188.77)(5281981=16240.45)(7241981=8731.71)(8261981=15252.63)(9001981=15696.2)(9091981=15252.63)(1241982=16191.76)(5781982=22387.66)(7521982=19497.07)(8401982=22246.01)(4701983=4776.54)(3521984=23382.99)(6161989=.)(7561989=32133)(401990=19539.81)(561990=18850.4)(1001990=1720.28)(1241990=19273.7)(1521990=3069.87)(1561990=391.65)(2031990=5336.91)(2081990=24102.31)(2331990=3787.1)(2501990=19181.21)(2761990=19429.94)(3521990=26483.49)(3561990=317.15)(3721990=13784.08)(3801990=16526.7)(3921990=33279.51)(4281990=3901.19)(4401990=4354.04)(4841990=4966.3)(5281990=19408.39)(5661990=386.25)(5781990=27301.01)(6161990=3099.24)(6201990=8562.74)(6431990=2602.25)(7031990=3703.09)(7101990=3151.84)(7241990=11346.18)(7521990=23318.26)(8261990=19647.21)(8401990=28262.62)(9091990=19647.21)(321991=6213.83)(761991=3079.66)(2031991=4741.91)(3481991=3671.13)(7031991=3163.41)(7051992=6949.34)(6421993=1558.15)(401999=23436.61)(561999=21836.9)(1001999=1456.37)(1911999=3935.8)(2031999=5322.6)(2081999=29069.96)(2331999=3688.8)(2501999=21776.43)(2761999=22428.94)(3001999=10079)(3481999=4334.13)(3521999=29853.68)(3721999=23449.11)(3801999=18611.54)(4281999=3024.14)(4401999=3123.75)(4421999=43267.25)(4701999=9391.2)(5281999=23635.6)(6161999=4253.35)(6201999=10654.17)(6421999=1615.93)(6431999=1613.7)(7031999=3672.74)(7051999=9343.18)(7241999=13845.51)(7521999=26187.51)(8041999=594.28)(8261999=23613.87)(9091999=23613.87)(1122000=1563.2)(2462000=23291.79)(7922001=2689.86)
recode GDP_pc 46000/8912001=.
** TRUST
sort s025
recode a165 (2=0)
by s025: egen trust= mean(a165)
* UNEMPL
gen unempl=s025
recode unempl (321991=5.8)(401990=3.2)(401999=3.7)(561981=.)(561990=7.2)(561999=8.6)(761991=. )(1001990=.)(1001999=14.1)(1122000=16.3)(1241982=11)(1241990=8.2)(1521990=5.7)(1561990=2.5)(1911999=13.5)(2031990=.)(2031991=. )(2031999=8.7)(2081981=.)(2081990=8.3)(2081999=5.1)(2331990=0.6)(2331999=12.2)(2461990=3.1)(2462000=9.8)(2501981=7)(2501990=9.2)(2501999=11.7)(2761990=. )(2761999=8.4)(3001999=11.7)(3481991=. )(3481999=7)(3521984=. )(3521990=. )(3521999=2)(3561990=. )(3721981=10.5)(3721990=13)(3721999=5.7)(3801981=7.9)(3801990=11.4)(3801999=11.3)(3921990=2.1)(4281990=. )(4281999=14)(4401990=. )(4401999=14.6)(4421999=2.3)(4701983=. )(4701999=. )(4841990=. )(5281981=6.9)(5281990=7.4)(5281999=3.5)(5661990=. )(5781982=2.7)(5781990=5.3)(6161989=. )(6161990=. )(6161999=12.5)(6201990=4.7)(6201999=4.4)(6421993=. )(6421999=6.8)(6431990=. )(6431999=13.4)(7031990=. )(7031991=. )(7031999=16.4)(7051992=. )(7051999=7.4)(7101990=. )(7241981=13.7)(7241990=16)(7241999=15.6)(7521982=3.5)(7521990=1.8)(7521999=7.1)(7561989=. )(7922001=8.4)(8041999=11.6)(8261981=.)(8261990=6.8)(8261999=5.9)(8401982=9.7)(8401990=5.6)(9001981=.)(9091981=.)(9091990=6.8)(9091999=5.9)
recode unempl 31/8912001=.
* GROWTH
gen GDP_growth=s025
recode GDP_growth  (321991=12.67)(401990=4.6)(401999=3.32)(561981=-0.28)(561990=3.14)(561999=3.19)(761991=1.3)(1001990=-9.12)(1001999=2.3)(1122000=5.8)(1241982=-2.92)(1241990=0.18)(1521990=3.7)(1561990=3.8)(1911999=-0.86)(2031990=-11.61)(2031991=-11.61)(2031999=1.21)(2081981=-2.05)(2081990=0.97)(2081999=2.64)(2331990=-7.12)(2331999=0.31)(2462000=5.12)(2501981=1.58)(2501990=2.68)(2501999=3.35)(2761990=5.72)(2761999=2.01)(3001999=3.42)(3481991=-11.89)(3481999=4.15)(3521984=4.13)(3521990=1.17)(3521999=4.41)(3561990=5.81)(3721981=3.33)(3721990=8.47)(3721999=11.1)(3801981=0.78)(3801990=1.97)(3801999=1.66)(3921990=5.2)(4281990=-7.49)(4281999=3.29)(4401990=-5.83)(4401999=-1.7)(4421999=7.81)(4701983=-0.61)(4701999=3.99)(4841990=5.07)(5281981=-0.51)(5281990=4.06)(5281999=4)(5661990=8.2)(5781982=0.49)(5781990=2.04)(6161989=.)(6161990=.)(6161999=4.52)(6201990=3.95)(6201999=3.8)(6421993=1.66)(6421999=-1.2)(6431990=-3)(6431999=6.4)(7031990=-2.67)(7031991=-14.57)(7031999=1.47)(7051992=-5.46)(7051999=5.42)(7101990=-0.32)(7241981=-0.13)(7241990=3.78)(7241999=4.22)(7521982=1.18)(7521990=1.03)(7521999=4.58)(7561989=4.55)(7922001=-7.49)(8041999=-0.2)(8261981=-1.44)(8261990=0.76)(8261999=2.86)(8401982=-1.97)(8401990=1.86)(9001981=0.1)(9091981=-1.44)(9091990=0.76)(9091999=2.86)
recode GDP_growth 20/8912001=.
* LEGAL ORIGIN
gen civ_com=s003
recode civ_com (32=1)(36=0)(40=1)(56=1)(76=1)(124=0)(152=1)(170=1)(208=1)(218=1)(818=1)(246=1)(250=1)(276=1)(300=1)(344=0)(356=0)(360=1)(372=0)(376=0)(380=1)(392=1)(400=1)(404=0)(458=0)(484=1)(528=1)(554=0)(566=0)(578=1)(586=0)(604=1)(608=1)(620=1)(702=0)(710=0)(410=1)(724=1)(144=0)(752=1)(756=1)(158=1)(764=0)(792=1)(826=0)(840=0)(858=1)(862=1)(716=0)(909=0)(900=1)(901=1)
recode civ_com 2/891=.
* BANK 
gen bank_own=s025
recode bank_own (561981=10)(2081981=10)(2501981=10)(3721981=8)(3801981=5)(5281981=10)(9091981=10)(7241981=8)(8261981=10)(9001981=5)(1241982=10)(5781982=10)(7521982=8)(8401982=9.5)(4701983=0)(3521984=2)(6161989=0)(7561989=5)(401990=5)(561990=10)(1001990=0)(1241990=10)(1521990=8)(1561990=0)(2031990=0)(2081990=10)(2331990=0)(2461990=8)(2501990=10)(2761990=5)(3521990=2)(3561990=0)(3721990=8)(3801990=5)(3921990=5)(4281990=.)(4401990=.)(4841990=0)(5281990=10)(5661990=2)(9091990=10)(5781990=8)(6161990=0)(6201990=2)(6431990=0)(7031990=.)(7101990=10)(7241990=8)(7521990=8)(8261990=10)(8401990=10)(321991=5)(761991=5)(2031991=0)(3481991=2)(7031991=.)(7051992=.)(6421993=0)(401999=5)(561999=10)(1001999=2)(1911999=0)(2031999=5)(2081999=10)(2331999=5)(2501999=10)(2761999=5)(3001999=5)(3481999=8)(3521999=2)(3721999=8)(3801999=5)(4281999=.)(4401999=5)(4421999=10)(4701999=0)(5281999=10)(9091999=10)(6161999=2)(6201999=2)(6421999=2)(6431999=2)(7031999=5)(7051999=5)(7241999=8)(7521999=8)(8261999=10)(8041999=0)(1122000=.)(2462000=10)(7922001=5)
recode bank_own 11/8912001=.
* CREDIT REGULATION
gen cred_reg=s025
recode cred_reg (561981=8.6)(2081981=9.4)(2501981=8.9)(3721981=7.3)(3801981=5.0)(5281981=9.4)(9091981=7.3)(7241981=7.4)(8261981=7.3)(9001981=7.6)(1241982=9.7)(5781982=7.2)(7521982=7.6)(8401982=9.5)(4701983=5.1)(3521984=5.2)(6161989=0.4)(7561989=8.1)(401990=7.5)(561990=8.4)(1001990=1.7)(1241990=9.7)(1521990=8.4)(1561990=0.0)(2031990=0.0)(2081990=9.3)(2331990=0.0)(2461990=9.3)(2501990=9.0)(2761990=7.6)(3521990=6.3)(3561990=5.1)(3721990=8.8)(3801990=6.9)(3921990=8.0)(4281990=.)(4401990=.)(4841990=4.7)(5281990=9.3)(5661990=3.6)(9091990=9.9)(5781990=8.5)(6161990=0.4)(6201990=5.8)(6431990=0.2)(7031990=.)(7101990=9.1)(7241990=8.3)(7521990=8.4)(8261990=9.9)(8401990=9.6)(321991=3.7)(761991=3.9)(2031991=0.0)(3481991=4.4)(7031991=.)(7051992=.)(6421993=0.0)(401999=6.9)(561999=8.0)(1001999=4.3)(1911999=3.4)(2031999=5.7)(2081999=9.1)(2331999=4.3)(2501999=8.4)(2761999=7.8)(3001999=5.9)(3481999=6.8)(3521999=6.9)(3721999=8.4)(3801999=6.6)(4281999=3.7)(4401999=4.4)(4421999=8.4)(4701999=6.2)(5281999=9.0)(9091999=9.3)(6161999=4.0)(6201999=7.0)(6421999=0.7)(6431999=4.7)(7031999=5.7)(7051999=6.5)(7241999=7.9)(7521999=8.6)(8261999=9.3)(8041999=1.8)(1122000=.)(2462000=9.2)(7922001=6.0)
recode cred_reg 11/8912001=.
* LABOR REGULATION
gen lab_regul=s025
recode lab_regul ( 561981 = 3.5 )( 2081981 = 3.5 )( 2501981 = 3.9 )( 3721981 = 6.6 )( 3801981 = 4.1 )( 5281981 = 3.0 )( 9091981 = 6.7 )( 7241981 = 3.6 )( 8261981 = 6.7 )( 9001981 = 7.3 )( 1241982 = 3.3 )( 5781982 = 3.5 )( 7521982 = 4.1 )( 8401982 = 7.7 )( 4701983 = . )( 3521984 = . )( 6161989 = 3.6 )( 7561989 = 5.5 )( 401990 = 4.6 )( 561990 = 3.6 )( 1001990 = . )( 1241990 = 7.1 )( 1521990 = 4.9 )( 1561990 = 3.2 )( 2031990 = . )( 2081990 = 4.7 )( 2331990 = . )( 2461990 = 3.7 )( 2501990 = 3.8 )( 2761990 = 3.5 )( 3521990 = 6.8 )( 3561990 = 6.3 )( 3721990 = 6.5 )( 3801990 = 4.2 )( 3921990 = 7.2 )( 4281990 = . )( 4401990 = . )( 4841990 = 5.7 )( 5281990 = 2.8 )( 5661990 = . )( 9091990 = 7.2 )( 5781990 = 3.6 )( 6161990 = 3.6 )( 6201990 = 3.1 )( 6431990 = 1.8 )( 7031990 = . )( 7101990 = 3.9 )( 7241990 = 3.7 )( 7521990 = 4.0 )( 8261990 = 7.2 )( 8401990 = 7.7 )( 321991 = 3.5 )( 761991 = 4.8 )( 2031991 = . )( 3481991 = . )( 7031991 = . )( 7051992 = . )( 6421993 = . )( 401999 = 3.9 )( 561999 = 5.0 )( 1001999 = 4.9 )( 1911999 = . )( 2031999 = 5.2 )( 2081999 = 4.6 )( 2331999 = 4.7 )( 2501999 = 5.0 )( 2761999 = 2.9 )( 3001999 = 3.4 )( 3481999 = 5.6 )( 3521999 = 6.7 )( 3721999 = 5.3 )( 3801999 = 3.5 )( 4281999 = 4.5 )( 4401999 = 4.2 )( 4421999 = . )( 4701999 = . )( 5281999 = 5.2 )( 9091999 = 6.9 )( 6161999 = 4.2 )( 6201999 = 4.5 )( 6421999 = 6.3 )( 6431999 = 4.5 )( 7031999 = 4.5 )( 7051999 = 3.6 )( 7241999 = 3.9 )( 7521999 = 3.4 )( 8261999 = 6.9 )( 8041999 = 4.5 )( 1122000 = . )( 2462000 = 3.3 )( 7922001 = 4.5 )
recode lab_regul 11/8912001=.
* MINIMUM WAGE
gen min_wage=s003
recode min_wage ( 32 = 1 )( 40 = 0 )( 56 = 1 )( 76 = 1 )( 100 = 1 )( 124 = 1 )( 152 = 1 )( 156 = 1 )( 191 = 1 )( 203 = 1 )( 208 = 0 )( 246 = 0 )( 250 = 1 )( 900 = 0 )( 276 = 0 )( 300 = 1 )( 348 = 1 )( 356 = 1 )( 372 = 0 )( 380 = 0 )( 392 = 1 )( 428 = 1 )( 440 = 1 )( 484 = 1 )( 528 = 1 )( 566 = 1 )( 578 = 0 )( 616 = 1 )( 620 = 1 )( 642 = 1 )( 643 = 1 )( 703 = 1 )( 705 = 1 )( 710 = 0 )( 724 = 1 )( 752 = 0 )( 756 = 0 )( 792 = 1 )( 826 = 0 )( 804 = 1 )( 840 = 1 )
recode min_wage 2/909=.

** INTERACTIONS
gen findev_3= dum_empl3 *findev
gen  GDP_pc_3= dum_empl3 *GDP_pc
gen age_sq = x003* x003
gen trust_3= dum_empl3 *trust
gen findev_3_sq=findev_3*findev_3
gen findev_3_cub=findev_3*findev_3*findev_3
gen unempl_3= dum_empl3 *unempl
gen GDP_growth_3= dum_empl3 *GDP_growth
gen civ_com_3=civ_com*dum_empl3
gen bank_own_3=bank_own*dum_empl3
gen cred_reg_3=cred_reg*dum_empl3
gen lab_regul_3=lab_regul*dum_empl3
gen min_wage_3=min_wage*dum_empl3
gen findev_3_100=findev_3/100
gen findev_3_100_sq=findev_3/100*findev_3/100
gen findev_3_100_cub=findev_3/100*findev_3/100*findev_3/100
gen GDP_pc_3_1000= GDP_pc_3/1000
save "DATABASE.dta"


